package com.itnoob.command1.example.task;

import com.itnoob.command1.example.service.ProductService;

/**
 * 具体命令类
 * @author zhoujun
 * @date 2025/3/18 23:24
 */
public class GetProductTask implements Task{

    private ProductService productService;

    private int productId;

    public GetProductTask(ProductService productService, int productId) {
        this.productService = productService;
        this.productId = productId;
    }

    @Override
    public Object call() throws Exception {
        //调用接受者获取产品的方法,并返回结果
        return productService.getProduct(productId);
    }
}
